package demoMod.nanaki.patches;

import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.saveAndContinue.SaveFile;
import com.megacrit.cardcrawl.screens.DeathScreen;
import com.megacrit.cardcrawl.vfx.AbstractGameEffect;
import demoMod.anm2player.AnimatedActor;
import demoMod.nanaki.stances.AbstractStrophe;
import demoMod.nanaki.vfx.StropheCircleEffect;

public class AbstractDungeonPatch {
    @SpirePatch(
            clz = AbstractDungeon.class,
            method = "nextRoomTransition",
            paramtypez = {
                    SaveFile.class
            }
    )
    @SpirePatch(
            clz = AbstractDungeon.class,
            method = "reset"
    )
    @SpirePatch(
            clz = DeathScreen.class,
            method = SpirePatch.CONSTRUCTOR
    )
    public static class PatchNextRoomTransition {
        public static void Prefix() {
            for (AnimatedActor actor : AbstractStrophe.vfxList) {
                actor.dispose();
            }
            AbstractStrophe.vfxList.clear();
            for (AbstractGameEffect effect : AbstractDungeon.effectList) {
                if (effect instanceof StropheCircleEffect) {
                    System.out.println("disposed a strophe circle effect.");
                    effect.dispose();
                    effect.isDone = true;
                }
            }
        }
    }
}
